function [newPath]= addBackupNodesToPrimary(primaryPath, backubPath, primarySender, primaryReceiver)
  %my change
    PP = length(primaryPath);
    BP = length(backubPath);
    PS = length(primarySender); 
    PR = length(primaryReceiver);
    destination = primaryPath(PP);
    counter = 1;
    start = 1;
    for i = 1:PS
       firstTest = 1;
       coverOtherLinks = 1;
       sndPS = primarySender(i);       
       rcv = primaryReceiver(i);
       for j = start:PP
           if coverOtherLinks == 1
                   sndPP = primaryPath(j);
                   if sndPS == sndPP                    
                       for k = 1:BP
                           sndBP = backubPath(k);
                           if sndBP == sndPP
                               m = k;                           
                               for l = m:BP
                                   sndBP = backubPath(l);
                                   if sndBP == rcv
                                       if sndBP == destination
                                           firstTest = -1;                                            
                                       else
                                           firstTest = 0;  
                                       end
                                   end
                                   if firstTest == 1
                                       newPath(counter) = sndBP;
                                       counter = counter + 1;
                                   end
                               end
                           end
                       end
                   elseif firstTest == 1
                       newPath(counter) = sndPP;
                       counter = counter + 1;
                   elseif firstTest == -1
                       % still there is another nodes I've to add.
                       
                       if i ~= PS
                           coverOtherLinks = 0;
                           start = j;
                       else
                           newPath(counter) = sndPP;
                           counter = counter + 1;
                          firstTest = 1;                              
                       end
                   end
                end 
           end
    end    
end